<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>

<script>
window.onload=function()
{
		var oUl = document.getElementById('ul1');
	/*
		var oLi = oUl.getElementsByClassName('box');
	

	for(var i=0 ; i< oLi.length; i++)
		{
				oLi[i].style.background = 'red';
		}
		*/
	var oLi = oUl.getElementsByTagName('li');
	
	for(var i =0 ; i < oLi.length;i++)
		{
			  if(oLi[i].className =='box')
						{
							oLi[i].style.background = 'red';
						}
		}
		
};
</script>
</head>

<body>
<ul id="ul1">
	<li class="box"></li>
	<li class="box"></li>
	<li></li>
	<li class="box"></li>
</ul>
</body>
</html>
